package model;
import java.io.File;
import java.util.ArrayList;



public class OOPackage {
	 
	public String name;
	public String path;
	private String logicalPath; // ex: "pkg1.pkg2.pkg3" kind of path
	public String getLogicalPath() {
		return logicalPath;
	}

	public void setLogicalPath(String logicalPath) {
		this.logicalPath = logicalPath;
		int locationOfLastDot = logicalPath.lastIndexOf('.');
		this.name = logicalPath.substring(locationOfLastDot+1);
	}

	public File parent;
    private ArrayList<OOPackage> children;

	public ArrayList<OOPackage> getChildren() {
        if (this.children == null){
            return new ArrayList<OOPackage>();
        }
        return this.children;
    }
	
    public int getNumberOfChildren() {
        if (children == null) {
            return 0;
        }
        return children.size();
    }

    public void addChild(OOPackage child) {
        if (children == null) {
            children = new ArrayList<OOPackage>();
        }
        children.add(child);
    }

    public void removeChildAt(int index) throws IndexOutOfBoundsException {
        children.remove(index);
    }

	public void setName(String name2) {
		this.name=name2;
		
	}
}